﻿using System.Security.Principal;
using System.Threading;

namespace Inovout.Security
{
    public class DefaultAuthenticationService : IAuthenticationService
    {
        private IUserService userService;
        public DefaultAuthenticationService(IUserService userService)
        {
            this.userService = userService;
        }
        public IPrincipal GetCurrentUserPrincipal()
        {
            return new UserPrincipal(userService.GetByUserName(Thread.CurrentPrincipal.Identity.Name), Thread.CurrentPrincipal.Identity.IsAuthenticated);
        }  
    }
}
